qat.experimental.dialect.pulse.ir.ops module

class AcquireOp(frame, duration, weights=None, label=None)

Bases: AcquireOp, IRDLOperation, Operation, _IRNode, ABC, object

Represents an acquisition operation, which listens to the waveform input to the channel within the reference frame.

Acquisition is used within qubit readout. Often, the backend can support weighted acquisitions, where a custom array of real or complex numbers is used for demodulation. This can optionally be attached as an attribute to the acquisition. No validation is done to enforce length checks, as weights can be backend-specific.

Example of how this looks in textual MLIR:

%frame = pulse.create_frame(%frequency) : !pulse.frame<"channel_1">
%duration = pulse.constant<800e-9> : !pulse.time
%frame_result, %acquire_result = pulse.acquire(%frame, %duration)
    : (!pulse.frame<"channel_1">, !pulse.acquisition)
Variables:
  • frame – The SSA value representing the frame on which to perform the acquisition.

  • duration – The SSA value representing the duration of the acquisition, of type pulse.time.

  • frame_result – The SSA value representing the resulting frame after the acquisition, which can be used as an operand in later operations.

  • acquisition_result – The SSA value representing the resulting acquisition obtained from the acquisition, which can be used as an operand in later operations.

  • weights – Optional weights attribute for the acquisition.

  • label – Optional string attribute to label the acquisition operation. Used for observability and debugging, but does not semantically affect the operation or contribute to dataflow.

Parameters:
  • frame (SSAValue | Operation) – The SSA value representing the frame on which to perform the acquisition.

  • duration (SSAValue | Operation) – The SSA value representing the duration of the acquisition, of type pulse.time.

  • weights (Optional[WeightsAttr]) – Optional weights attribute for the acquisition.

  • label (Union[str, StringAttr, None]) – Optional string attribute used to label the acquisition for observability and debugging.

acquisition_result

Access a non-variadic construct which appears before any variadic arguments.

attributes: dict[str, Attribute]

The attributes attached to the operation.

duration

Access a non-variadic construct which appears before any variadic arguments.

frame

Access a non-variadic construct which appears before any variadic arguments.

frame_result

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

label

Accessor for an optional operation attribute.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.acquire'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
weights

Accessor for an optional operation attribute.

class AddOp(lhs, rhs, result_type)

Bases: InternalBinaryOp[PULSE_VAR_TYPE], Generic[PULSE_VAR_TYPE]

Represents addition of two values of the same type, including addition of frequencies, phases, durations, amplitudes and waveforms.

Example of how this looks in textual MLIR:

%frequency1 = pulse.constant<5e9> : !pulse.frequency
%frequency2 = pulse.constant<1e9> : !pulse.frequency
%result = pulse.add(%frequency1, %frequency2) : !pulse.frequency
Variables:
  • lhs – The left-hand side operand of the addition operation.

  • rhs – The right-hand side operand of the addition operation.

  • result – The SSA value representing the result of the addition operation, which can be used as an operand in later operations.

Parameters:
attributes: dict[str, Attribute]

The attributes attached to the operation.

classmethod get_irdl_definition()

Get the IRDL operation definition.

lhs

Access a non-variadic construct which appears before any variadic arguments.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.add'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

static py_operation(lhs, rhs)

Performs the addition operation on given literals.

This is used for constant folding.

result

Access a non-variadic construct which appears before any variadic arguments.

rhs

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
class BinaryOp(*, operands=None, result_types=None, properties=None, attributes=None, successors=None, regions=None)

Bases: IRDLOperation, ABC

Abstract base class for binary operations in the pulse dialect.

This is used to represent operations that take two operands of the same type and produce a result of the same type, such as addition and multiplication.

abstract property lhs: SSAValue
abstract property name: str
abstract static py_operation(lhs, rhs)

Hooks in the associated Python operation to be used as part of transforms and optimizations.

abstract property rhs: SSAValue
class BlackmanWaveformOp(width, amplitude, *drag_coefficients)

Bases: BlackmanWaveformOp, IRDLOperation, IsAnalyticalWaveformInterface, Operation, _IRNode, ABC, object

A Blackman-window shaped pulse, offering excellent spectral leakage suppression.

Example of how this looks in textual MLIR:

Variables:
  • width – The duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude – The amplitude of the waveform, represented as a SSA value of type pulse.amplitude.

  • result – The SSA value representing the resulting Blackman waveform, which can be used as an operand in later operations.

Parameters:
  • width (SSAValue | Operation) – The duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude (SSAValue | Operation) – The amplitude of the waveform, represented as a SSA value of type pulse.amplitude.

WAVEFORM_NAME: ClassVar[str] = 'blackman'

The string representation of the waveform which acts as a hook for waveform information that lives outside the IR.

amplitude

Access a non-variadic construct which appears before any variadic arguments.

attributes: dict[str, Attribute]

The attributes attached to the operation.

build_shape()

Build the waveform shape for this op from shape-specific operands.

Amplitude, duration, and DRAG coefficients are handled by the waveform evaluation pass. Returns None if any shape-defining operand is not a compile-time constant.

Returns:

The waveform shape instance, or None if it cannot be built.

drag_coefficients

Access a variadic construct in the case where it is the only variadic.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.blackman_waveform'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
width

Access a non-variadic construct which appears before any variadic arguments.

class CallKernelOp(callee, arguments, result_types)

Bases: CallKernelOp, IRDLOperation, Operation, _IRNode, ABC, object

Calls a KernelOp by symbol reference.

The callee is stored as a flat symbol reference and resolved through the enclosing symbol table. Verification for this operation is provided by CallKernelOpUserOpInterface and enforces:

  • the callee symbol exists,

  • the referenced symbol is a KernelOp,

  • argument count and argument types match the callee inputs,

  • result count and result types match the callee outputs.

Variables:
  • callee – Flat symbol reference naming the kernel to invoke.

  • arguments – Call operands passed positionally to the callee.

  • result – Values produced by the call, typed to the callee outputs.

Parameters:
  • callee (str | SymbolRefAttr) – Kernel symbol name/reference. String inputs are converted to FlatSymbolRefAttr.

  • arguments (Sequence[SSAValue | Operation]) – Positional SSA operands passed to the kernel.

  • result_types (Sequence[Attribute] | Sequence[Sequence[Attribute]]) – Expected call result types, which must match the callee output signature during verification.

arguments

Access a variadic construct in the case where it is the only variadic.

attributes: dict[str, Attribute]

The attributes attached to the operation.

callee

Accessor for an operation property.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.call_kernel'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a variadic construct in the case where it is the only variadic.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
class ConstantOp(value, result_type=None)

Bases: IRDLOperation, HasFolderInterface, Generic[PULSE_VAR_TYPE]

Represents a constant value of a given type. This is used to represent constant frequencies, phases, durations, amplitudes and waveforms in the IR.

Example of how this looks in textual MLIR:

%frequency = pulse.constant<5e9> : !pulse.frequency
Parameters:
attributes: dict[str, Attribute]

The attributes attached to the operation.

fold()

Returns the constant value, used within constant operation folding.

Return type:

Sequence[SSAValue | Attribute] | None

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.constant'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

value

Accessor for an operation property.

verify()

Verifies that the result type is consistent with the attribute provided.

verify_()
class CreateFrameOp(frequency, port, imbalance=None, phase_offset=None, acquire_allowed=None, pulse_allowed=None, track_phase=None)

Bases: CreateFrameOp, IRDLOperation, Operation, _IRNode, ABC, object

Creates a frame, which is a medium for waveforms to be played at a given frequency, and tracks any phase manipulations.

Frames are associated with a port that the pulses will be played on. They can have many-to-one association, allowing multiple frames to act concurrently on a single port.

They are defined by a static frequency, and optionally take attributes associated with the control hardware calibrated for that frame.

Example of how this looks in textual MLIR:

%frame = pulse.create_frame(%frequency) : !pulse.frame<"channel_1">
Variables:
  • frequency – The frequency of the frame.

  • imbalance – An optional attribute that stores the imbalance between I and Q paths, obtained from mixer calibrations.

  • phase_offset – An optional attribute that stores the phase offset between I and Q paths, obtained from mixer calibrations.

  • acquire_allowed – An optional boolean attribute that states if the frame is allowed to do acquisitions. This annotation is motivated by the fact not all IO channels might allow acquisition, and also simplifies allocation logic. Defaults to True.

  • pulse_allowed – An optional boolean attribute that states if the frame is allowed to play pulses. This annotation is motivated by optimization logic for allocation on the hardware. Defaults to True.

  • track_phase – An optional boolean attribute that states if phase strictly needs to be tracked when frame swapping on hardware. If False, this highly simplifies allocation logic, allowing us to make more efficient use of hardware. This should be used carefully. Defaults to True.

  • port – The string attribute containing the port identifier.

  • result – The SSA value representing the Frame. Can only be consumed by a single operation.

Parameters:
  • frequency (SSAValue | Operation) – The SSA value representing the frequency of the frame.

  • port (StringAttr) – The string attribute containing the port identifier.

  • imbalance (Optional[FloatAttr]) – The float attribute representing the imbalance between I and Q paths, obtained from mixer calibrations. Optional.

  • phase_offset (Optional[FloatAttr]) – The float attribute representing the phase offset between I and Q paths, obtained from mixer calibrations. Optional.

  • acquire_allowed (Optional[IntegerAttr[IntegerType]]) – The boolean attribute stating if the frame is allowed to do acquisitions. Defaults to an attribute with True.

  • pulse_allowed (Optional[IntegerAttr[IntegerType]]) – The boolean attribute stating if the frame is allowed to play pulses. Defaults to an attribute with True.

  • track_phase (Optional[IntegerAttr[IntegerType]]) – The boolean attribute stating if phase strictly needs to be tracked when frame swapping on hardware. Defaults to an attribute with True.

acquire_allowed

Accessor for an operation attribute.

attributes: dict[str, Attribute]

The attributes attached to the operation.

frequency

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

imbalance

Accessor for an optional operation attribute.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.create_frame'

The operation name. Should be a static member of the class

phase_offset

Accessor for an optional operation attribute.

property port: StringAttr

Returns the port that the frame plays on as a string attribute.

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

pulse_allowed

Accessor for an operation attribute.

result

Access a non-variadic construct which appears before any variadic arguments.

track_phase

Accessor for an operation attribute.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
class DiscriminateOp(value, policy)

Bases: DiscriminateOp, IRDLOperation, Operation, _IRNode, ABC, object

Discriminate equalised values to integer state keys.

State discrimination is the mechanism of mapping an IQ value into a discrete state key, which can be used to classify the qubit state. In the most simple situation, this maps to a binary outcome, but in general, can map to many integer keys, with each revealing different information about the qubit state, or uncertainty in the qubit state.

Variables:
  • value – The SSA value representing the IQ value operand subjected to state discrimination.

  • policy – The state discrimination policy to apply as an attribute.

  • result – The discriminated integer state result as an SSA value.

Parameters:
  • value (Union[SSAValue[IQResultType], Operation]) – The IQ value result, or an operation producing the IQ value as a result.

  • policy (DiscriminatorPolicyAttr) – The state discrimination policy to be used.

attributes: dict[str, Attribute]

The attributes attached to the operation.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.discriminate'

The operation name. Should be a static member of the class

policy

Accessor for an operation property.

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

value

Access a non-variadic construct which appears before any variadic arguments.

verify_()

Verifies that the result state type matches the attached policy.

class EqualiseOp(value, affine_transform)

Bases: EqualiseOp, IRDLOperation, Operation, _IRNode, ABC, object

Apply an affine transformation to an IQ result from a readout.

This is expected to be the first step in the post-processing pipeline of a result, which is used to transform the IQ results into a standardized form for state discrimination.

In superconducting qubit readout, the downconverted IQ signals can be distorted by hardware imperfections:

  • Phase imbalance: The I and Q channels may not be perfectly orthogonal, leading to a rotation of the IQ plane.

  • Gain imbalance: The I and Q channels may have different gains due to unequal amplifier chains.

  • DC offsets: Mixer leakage and biases in the amplifier chains can introduce DC offsets in the I and Q channels.

The result is that the (I, Q) samples cluster on a distorted, offset ellipse rather than a compact point, degrading any downstream discriminator.

The Equalise instruction corrects all three imperfections in a single real affine transform with calibrated values:

\[\begin{split}\begin{pmatrix} I' \\ Q' \end{pmatrix} = A \begin{pmatrix} I \\ Q \end{pmatrix} + \begin{pmatrix} b_I \\ b_Q \end{pmatrix}\end{split}\]

where A is a real 2×2 matrix (transform) and [b_I, b_Q] is the real offset vector (offset). The output is returned as a complex value I' + j Q'.

The affine transformation is represented by a property and not an operand because it is expected to be a constant value, and not a value that is computed at runtime. This allows for more efficient compilation and optimization of the pulse program.

Variables:
  • value – The SSA value representing the IQ result to be equalized.

  • affine_transform – The EqualiseAttr property that defines the correction to be applied to the IQ result.

  • result – The SSA value representing the resulting equalized IQ result, which can be used as an operand in later operations.

Parameters:
  • value (SSAValue | Operation) – The SSA value representing the IQ result to be equalized.

  • affine_transform (EqualiseAttr) – The EqualiseAttr property that defines the correction to be applied to the IQ result.

affine_transform

Accessor for an operation property.

attributes: dict[str, Attribute]

The attributes attached to the operation.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.equalise'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

value

Access a non-variadic construct which appears before any variadic arguments.

verify_()
class GaussianSquareWaveformOp(width, amplitude, fractional_rise, fractional_top_width, regularize, *drag_coefficients)

Bases: GaussianSquareWaveformOp, IRDLOperation, IsAnalyticalWaveformInterface, Operation, _IRNode, ABC, object

A Gaussian-square waveform with normalized shape parameters.

Example of how this looks in textual MLIR:

%width = pulse.constant<128e-9> : !pulse.time
%amplitude = pulse.constant<0.5> : !pulse.amplitude
%fractional_rise = arith.constant<0.2> : !f64
%fractional_top_width = arith.constant<0.5> : !f64
%waveform = pulse.gaussian_square_waveform<true>(
    %width, %amplitude, %fractional_rise, %fractional_top_width
) : !pulse.waveform
Variables:
  • width – The duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude – The amplitude of the waveform, represented as a SSA value of type pulse.amplitude.

  • fractional_rise – Rise and fall width proportion in normalized units.

  • fractional_top_width – Flat-top proportion in normalized units.

  • drag_coefficients – Optional first-order DRAG coefficient. Gaussian-square only supports one coefficient because higher-order derivatives are not part of the shape model.

  • regularize – Whether to make the envelope zero at the edges and one at the peak.

  • result – The SSA value representing the resulting Gaussian-square waveform, which can be used as an operand in later operations.

WAVEFORM_NAME: ClassVar[str] = 'gaussian_square'

The string representation of the waveform which acts as a hook for waveform information that lives outside the IR.

amplitude

Access a non-variadic construct which appears before any variadic arguments.

attributes: dict[str, Attribute]

The attributes attached to the operation.

build_shape()

Build the waveform shape for this op from shape-specific operands.

Amplitude, duration, and DRAG coefficients are handled by the waveform evaluation pass. Returns None if any shape-defining operand is not a compile-time constant.

Returns:

The waveform shape instance, or None if it cannot be built.

drag_coefficients

Access a variadic construct in the case where it is the only variadic.

fractional_rise

Access a non-variadic construct which appears before any variadic arguments.

fractional_top_width

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.gaussian_square_waveform'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

regularize

Accessor for an operation property.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
width

Access a non-variadic construct which appears before any variadic arguments.

class GaussianWaveformOp(width, amplitude, fractional_breadth, regularize, *drag_coefficients)

Bases: GaussianWaveformOp, IRDLOperation, IsAnalyticalWaveformInterface, Operation, _IRNode, ABC, object

Represents a Gaussian waveform with normalized shape parameters.

Example of how this looks in textual MLIR:

%width = pulse.constant<128e-9> : !pulse.time
%amplitude = pulse.constant<0.5> : !pulse.amplitude
%fractional_breadth = arith.constant<0.47> : !f64
%waveform = pulse.gaussian_waveform<false>(
    %width, %amplitude, %fractional_breadth
) : !pulse.waveform
Variables:
  • width – The duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude – The amplitude of the waveform, represented as a SSA value of type pulse.amplitude.

  • fractional_breadth – Gaussian width proportion in normalized units.

  • regularize – Whether to make the envelope zero at the edges and one at the peak.

  • result – The SSA value representing the resulting Gaussian waveform, which can be used as an operand in later operations.

Parameters:
  • width (SSAValue | Operation) – The duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude (SSAValue | Operation) – The amplitude of the waveform, represented as a SSA value of type pulse.amplitude.

  • fractional_breadth (SSAValue | Operation) – Gaussian width proportion in normalized units.

  • regularize (Union[bool, IntegerAttr[IntegerType]]) – Whether to normalize the shape to zero at edges.

WAVEFORM_NAME: ClassVar[str] = 'gaussian'

The string representation of the waveform which acts as a hook for waveform information that lives outside the IR.

amplitude

Access a non-variadic construct which appears before any variadic arguments.

attributes: dict[str, Attribute]

The attributes attached to the operation.

build_shape()

Build the waveform shape for this op from shape-specific operands.

Amplitude, duration, and DRAG coefficients are handled by the waveform evaluation pass. Returns None if any shape-defining operand is not a compile-time constant.

Returns:

The waveform shape instance, or None if it cannot be built.

drag_coefficients

Access a variadic construct in the case where it is the only variadic.

fractional_breadth

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.gaussian_waveform'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

regularize

Accessor for an operation property.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
width

Access a non-variadic construct which appears before any variadic arguments.

class IntegrateOp(acquisition)

Bases: IntegrateOp, IRDLOperation, Operation, _IRNode, ABC, object

Represents the integration of an acquisition result into a single IQ point.

Example of how this looks in textual MLIR:

%frame = pulse.create_frame(%frequency) {physical_channel = "channel_1"}
    : !pulse.frame<"output">
%duration = pulse.constant<800e-9> : !pulse.time
%frame_result, %acquisition_result = pulse.acquire(%frame, %duration)
    : (!pulse.frame<"output">, !pulse.acquisition)
%integration_result = pulse.integrate(%acquisition_result) : !pulse.iq_result
Variables:
  • acquisition – The SSA value representing the acquisition result to be integrated.

  • result – The SSA value representing the resulting IQ result obtained from the integration, which can be used as an operand in later operations.

Parameters:

acquisition (SSAValue) – The SSA value representing the acquisition result to be integrated.

acquisition

Access a non-variadic construct which appears before any variadic arguments.

attributes: dict[str, Attribute]

The attributes attached to the operation.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.integrate'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
class InternalBinaryOp(lhs, rhs, result_type)

Bases: BinaryOp, Generic[PULSE_VAR_TYPE], ABC

Abstract base class for operations that take two operands of a type within the pulse dialect and return a result of the same type, such as addition and subtraction.

Parameters:
attributes: dict[str, Attribute]

The attributes attached to the operation.

lhs = <xdsl.irdl.operations._OperandFieldDef object>
location: LocationAttr

The source location attached to this operation.

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result = <xdsl.irdl.operations._ResultFieldDef object>
rhs = <xdsl.irdl.operations._OperandFieldDef object>
traits: ClassVar[OpTraits]

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify()

Ensures that the types of the operands and result are consistent.

class KernelOp(name, function_type, region=<class 'xdsl.ir.core.Region.DEFAULT'>)

Bases: KernelOp, IRDLOperation, Operation, _IRNode, ABC, object

Represents a pulse-level kernel with function semantics.

A kernel is the primary execution scope for a pulse program. It is modelled as a symbol operation with a function signature and a body region. Calls target a kernel via symbol reference, and verification ensures call operands and results match the signature.

The kernel is also an isolation boundary. Values such as frames, which model mutable execution context on control hardware, cannot cross this boundary via function arguments/results.

Classical operations may appear in the body when they are intended to execute within the same hardware-scoped program, for example hardware-supported post-processing or feed- forward control.

Variables:
  • sym_name – Symbol name used to reference this kernel from call sites.

  • function_type – Function signature describing input and output value types.

  • body – Region containing the kernel entry block and pulse program operations.

Parameters:
  • name (str | StringAttr) – Kernel symbol name. String inputs are converted to StringAttr.

  • function_type (FunctionType | tuple[Sequence[Attribute], Sequence[Attribute]]) – Kernel signature. A tuple form (inputs, outputs) is converted to FunctionType via FunctionType.from_lists.

  • region (Region | type[DEFAULT]) – Optional body region. By convention this region contains the entry block and terminates with ReturnOp when results are produced.

attributes: dict[str, Attribute]

The attributes attached to the operation.

body

Access a non-variadic construct which appears before any variadic arguments.

function_type

Accessor for an operation property.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.kernel'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

sym_name

Accessor for an operation property.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()

Verifies kernel signature/body consistency and boundary constraints.

Enforced invariants:

  • function_type inputs must not contain FrameType.

  • function_type outputs must not contain FrameType.

  • If a body block exists, entry block argument types must exactly match function_type input types in order.

class MaxTimeOp(*times)

Bases: MaxTimeOp, IRDLOperation, Operation, _IRNode, ABC, object

Finds the maximum of a variable number of time operands, returning a time result.

This is used to resolve the maximum duration of a set of operations, which is particularly relevant for resolving the duration of synchronizations between multiple frames.

Example of how this looks in textual MLIR:

%time1 = pulse.constant<128e-9> : !pulse.time
%time2 = pulse.constant<256e-9> : !pulse.time
%time3 = pulse.constant<64e-9> : !pulse.time
%max_time = pulse.max_time(%time1, %time2, %time3) : !pulse.time
Variables:
  • times – A variable number of SSA values representing time operands, which must all be of type pulse.time. At least one operand is required.

  • result – The SSA value representing the maximum of the time operands, which can be used as an operand in later operations.

Parameters:

times (Union[SSAValue[TimeType], Operation]) – A variable number of SSA values representing time operands, which must all be of type pulse.time.

attributes: dict[str, Attribute]

The attributes attached to the operation.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.max_time'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

times

Access a variadic construct in the case where it is the only variadic.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
class MixOp(lhs, rhs)

Bases: InternalBinaryOp[WaveformType]

Represents the element-wise mixing of one waveform envelope with another.

Mixing two waveforms does a pointwise multiplication of the two waveform envelopes, resulting in a new waveform that has the same duration as the input waveforms.

%duration = pulse.constant<128e-9> : !pulse.time
%amplitude1 = pulse.constant<0.5> : !pulse.amplitude
%waveform1 = pulse.square_waveform(%duration, %amplitude1) : !pulse.waveform
%amplitude2 = pulse.constant<0.25> : !pulse.amplitude
%waveform2 = pulse.square_waveform(%duration, %amplitude2) : !pulse.waveform
%result = pulse.mix(%waveform1, %waveform2) : !pulse.waveform
Variables:
  • lhs – The left-hand side operand of the mixing operation, which is a waveform.

  • rhs – The right-hand side operand of the mixing operation, which is a waveform.

  • result – The SSA value representing the waveform result of the mixing operation, which can be used as an operand in later operations.

Parameters:
  • lhs (Union[SSAValue[WaveformType], Operation]) – The left-hand side operand of the mixing operation, which is a waveform.

  • rhs (Union[SSAValue[WaveformType], Operation]) – The right-hand side operand of the mixing operation, which is a waveform.

attributes: dict[str, Attribute]

The attributes attached to the operation.

classmethod get_irdl_definition()

Get the IRDL operation definition.

lhs

Access a non-variadic construct which appears before any variadic arguments.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.mix'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

static py_operation(lhs, rhs)

Performs the mixing operation on given literals.

This is used for constant folding.

result

Access a non-variadic construct which appears before any variadic arguments.

rhs

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
class ModuloOp(lhs, rhs, result_type)

Bases: InternalBinaryOp[PhaseType]

Represents the modulo operation on two phases.

Example of how this looks in textual MLIR:

%phase1 = pulse.constant<3.5> : !pulse.phase %phase2 = pulse.constant<1.0> : !pulse.phase %result = pulse.modulo(%phase1, %phase2) : !pulse.phase

Variables:
  • lhs – The left-hand side operand of the modulo operation, which must be phase type.

  • rhs – The right-hand side operand of the modulo operation, which must be phase type.

Parameters:
attributes: dict[str, Attribute]

The attributes attached to the operation.

classmethod get_irdl_definition()

Get the IRDL operation definition.

lhs

Access a non-variadic construct which appears before any variadic arguments.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.modulo'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

static py_operation(lhs, rhs)

Performs the modulo operation on given literals.

This is used for constant folding.

result

Access a non-variadic construct which appears before any variadic arguments.

rhs

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
class PhaseOp(frame, phase)

Bases: IRDLOperation, ABC

Abstract base class for operations that manipulate the phase of a frame.

Parameters:
  • frame (SSAValue | Operation) – The SSA value representing the frame whose phase is being manipulated.

  • phase (SSAValue | Operation) – The SSA value representing the phase operand, which specifies the amount by which to manipulate the phase.

attributes: dict[str, Attribute]

The attributes attached to the operation.

frame = <xdsl.irdl.operations._OperandFieldDef object>
location: LocationAttr

The source location attached to this operation.

abstract property name: str

To be specified by subclasses to define the operation name in MLIR.

phase = <xdsl.irdl.operations._OperandFieldDef object>
properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result = <xdsl.irdl.operations._ResultFieldDef object>
traits: ClassVar[OpTraits]

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

class PhaseSetOp(frame, phase)

Bases: PhaseSetOp, PhaseOp, IRDLOperation, Operation, _IRNode, ABC, object

Resets the accumulated phase of a frame to a given value.

Example of how this looks in textual MLIR:

%frame = pulse.create_frame(%frequency) : !pulse.frame<"channel_1">
%phase = pulse.constant<1.5708> : !pulse.phase
%frame2 = pulse.phase_set(%frame, %phase) : !pulse.frame<"channel_1">
Variables:
  • frame – The SSA value representing the frame whose phase is being set.

  • phase – The SSA value representing the phase operand, which specifies the value to which to set the phase.

  • result – The SSA value representing the resulting frame with the set phase, which can be used as an operand in later operations.

Parameters:
  • frame (SSAValue | Operation) – The SSA value representing the frame whose phase is being manipulated.

  • phase (SSAValue | Operation) – The SSA value representing the phase operand, which specifies the amount by which to manipulate the phase.

attributes: dict[str, Attribute]

The attributes attached to the operation.

frame

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.phase_set'

The operation name. Should be a static member of the class

phase

Access a non-variadic construct which appears before any variadic arguments.

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
class PhaseShiftOp(frame, phase)

Bases: PhaseShiftOp, PhaseOp, IRDLOperation, Operation, _IRNode, ABC, object

Changes the phase of a frame by a given amount. The resulting phase is relative to the current phase of the frame.

Phase shifts are used to create phase differences in superpositions of quantum states. They are how we implement virtual-Z gates.

Example of how this looks in textual MLIR:

%frame = pulse.create_frame(%frequency) : !pulse.frame<"channel_1">
%phase = pulse.constant<1.5708> : !pulse.phase
%frame2 = pulse.phase_shift(%frame, %phase) : !pulse.frame<"channel_1">
Variables:
  • frame – The SSA value representing the frame whose phase is being shifted.

  • phase – The SSA value representing the phase operand, which specifies the amount by which to shift the phase.

  • result – The SSA value representing the resulting frame with the shifted phase, which can be used as an operand in later operations.

Parameters:
  • frame (SSAValue | Operation) – The SSA value representing the frame whose phase is being manipulated.

  • phase (SSAValue | Operation) – The SSA value representing the phase operand, which specifies the amount by which to manipulate the phase.

attributes: dict[str, Attribute]

The attributes attached to the operation.

frame

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.phase_shift'

The operation name. Should be a static member of the class

phase

Access a non-variadic construct which appears before any variadic arguments.

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
class PulseOp(frame, waveform)

Bases: PulseOp, IRDLOperation, Operation, _IRNode, ABC, object

Represents a pulse, which is a waveform played on a frame at a given frequency, and with a given phase.

Example of how this looks in textual MLIR:

%frame = pulse.create_frame(%frequency) : !pulse.frame<"channel_1">
%duration = arith.constant<128e-9> : !pulse.time
%amplitude = arith.constant<0.5> : !pulse.amplitude
%waveform = pulse.square_waveform(%duration, %amplitude) : !pulse.waveform
%frame2 = pulse.pulse(%frame, %waveform) : !pulse.frame<"channel_1">
Variables:
  • frame – The SSA value representing the frame on which to play the pulse.

  • waveform – The SSA value representing the waveform to be played, of type pulse.waveform.

  • result – The SSA value representing the resulting frame after playing the pulse, which can be used as an operand in later operations.

Parameters:
  • frame (SSAValue | Operation) – The SSA value representing the frame on which to play the pulse.

  • waveform (SSAValue | Operation) – The SSA value representing the waveform to be played, of type pulse.waveform.

attributes: dict[str, Attribute]

The attributes attached to the operation.

frame

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.pulse'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
waveform

Access a non-variadic construct which appears before any variadic arguments.

class ReturnOp(*return_vals)

Bases: ReturnOp, IRDLOperation, Operation, _IRNode, ABC, object

Terminates a kernel and yields values to the caller.

This operation is valid only inside KernelOp and must be the final operation in its block (enforced by traits). Operand types must match the parent kernel’s function_type outputs exactly.

Variables:

arguments – Variable-length return operands yielded from the enclosing kernel.

Parameters:

return_vals (SSAValue | Operation) – SSA values returned to the caller. Their types are validated against the parent kernel signature.

arguments

Access a variadic construct in the case where it is the only variadic.

attributes: dict[str, Attribute]

The attributes attached to the operation.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.return'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()

Verifies return operand types against the parent kernel signature.

Parent-type and terminator placement constraints are enforced by traits before this method runs.

class RoundedSquareWaveformOp(width, amplitude, fractional_top_width, fractional_rise, *drag_coefficients)

Bases: RoundedSquareWaveformOp, IRDLOperation, IsAnalyticalWaveformInterface, Operation, _IRNode, ABC, object

A square pulse with smooth erf-shaped (S-curve) rise and fall.

 ____
/            ___|      |___

Example of how this looks in textual MLIR:

%width = pulse.constant<128e-9> : !pulse.time
%amplitude = pulse.constant<0.5> : !pulse.amplitude
%fractional_top_width = arith.constant<0.5> : !f64
%fractional_rise = arith.constant<0.1> : !f64
%waveform = pulse.rounded_square_waveform(
    %width, %amplitude, %fractional_top_width, %fractional_rise
)
: !pulse.waveform
Variables:
  • width – The duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude – The amplitude of the waveform, represented as a SSA value of type pulse.amplitude.

  • fractional_top_width – Flat-top proportion in normalized units.

  • fractional_rise – Edge-width proportion in normalized units.

  • result – The SSA value representing the resulting rounded square waveform that can be used as an operand in later operations.

Parameters:
  • width (SSAValue | Operation) – The duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude (SSAValue | Operation) – The amplitude of the waveform, represented as a SSA value of type pulse.amplitude.

  • fractional_top_width (SSAValue | Operation) – Flat-top proportion in normalized units.

  • fractional_rise (SSAValue | Operation) – Edge-width proportion in normalized units.

WAVEFORM_NAME: ClassVar[str] = 'rounded_square'

The string representation of the waveform which acts as a hook for waveform information that lives outside the IR.

amplitude

Access a non-variadic construct which appears before any variadic arguments.

attributes: dict[str, Attribute]

The attributes attached to the operation.

build_shape()

Build the waveform shape for this op from shape-specific operands.

Amplitude, duration, and DRAG coefficients are handled by the waveform evaluation pass. Returns None if any shape-defining operand is not a compile-time constant.

Returns:

The waveform shape instance, or None if it cannot be built.

drag_coefficients

Access a variadic construct in the case where it is the only variadic.

fractional_rise

Access a non-variadic construct which appears before any variadic arguments.

fractional_top_width

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.rounded_square_waveform'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
width

Access a non-variadic construct which appears before any variadic arguments.

class ScaleOp(lhs, rhs, result_type)

Bases: BinaryOp, Generic[PULSE_VAR_TYPE]

Represents the scaling of a type in the pulse dialect by some dimensionless quantity, represented by a floating point or complex number. This is used for scaling operations that are not necessarily multiplication, e.g. scaling the duration of a waveform by some factor.

Example of how this looks in textual MLIR:

%duration = pulse.constant<128e-9> : !pulse.time
%scale = arith.constant<0.5> : !f64
%result = pulse.scale(%scale, %duration) : !pulse.time
Variables:
  • lhs – The scaling factor, which is a dimensionless quantity represented by a floating point or complex number.

  • rhs – The operand to be scaled, which can be a frequency, phase, duration, amplitude or waveform.

  • result – The SSA value representing the result of the scaling operation, which can be used as an operand in later operations.

Parameters:
attributes: dict[str, Attribute]

The attributes attached to the operation.

classmethod get_irdl_definition()

Get the IRDL operation definition.

lhs

Access a non-variadic construct which appears before any variadic arguments.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.scale'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

static py_operation(lhs, rhs)

Performs the scaling operation on given literals.

This is used for constant folding.

result

Access a non-variadic construct which appears before any variadic arguments.

rhs

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify()

Ensures that the type of the operand and result are consistent.

verify_()
class SechWaveformOp(width, amplitude, fractional_breadth, regularize, *drag_coefficients)

Bases: SechWaveformOp, IRDLOperation, IsAnalyticalWaveformInterface, Operation, _IRNode, ABC, object

A hyperbolic-secant (sech) pulse envelope.

Implements a sech pulse defined by sech(x / width). Note that it is not normalized to be zero at the edges. The sech pulse has the desirable property of being its own Fourier transform (up to scaling), making it self-similar in time and frequency.

Example of how this looks in textual MLIR:

%width = pulse.constant<128e-9> : !pulse.time
%amplitude = pulse.constant<0.5> : !pulse.amplitude
%fractional_breadth = arith.constant<0.33> : !f64
%waveform = pulse.sech_waveform<false>(
    %width, %amplitude, %fractional_breadth
) : !pulse.waveform
Variables:
  • width – The duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude – The amplitude of the waveform, represented as a SSA value of type pulse.amplitude.

  • fractional_breadth – Sech width proportion in normalized units.

  • regularize – Whether to make the envelope zero at the edges and one at the peak.

  • result – The SSA value representing the resulting sech waveform, which can be used as an operand in later operations.

Parameters:
  • width (SSAValue | Operation) – The duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude (SSAValue | Operation) – The amplitude of the waveform, represented as a SSA value of type pulse.amplitude.

  • fractional_breadth (SSAValue | Operation) – Sech width proportion in normalized units.

  • regularize (Union[bool, IntegerAttr[IntegerType]]) – Whether to normalize the shape to zero at edges.

WAVEFORM_NAME: ClassVar[str] = 'sech'

The string representation of the waveform which acts as a hook for waveform information that lives outside the IR.

amplitude

Access a non-variadic construct which appears before any variadic arguments.

attributes: dict[str, Attribute]

The attributes attached to the operation.

build_shape()

Build the waveform shape for this op from shape-specific operands.

Amplitude, duration, and DRAG coefficients are handled by the waveform evaluation pass. Returns None if any shape-defining operand is not a compile-time constant.

Returns:

The waveform shape instance, or None if it cannot be built.

drag_coefficients

Access a variadic construct in the case where it is the only variadic.

fractional_breadth

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.sech_waveform'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

regularize

Accessor for an operation property.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
width

Access a non-variadic construct which appears before any variadic arguments.

class SetupHoldWaveformOp(width, amplitude, setup, fractional_rise)

Bases: SetupHoldWaveformOp, IRDLOperation, IsAnalyticalWaveformInterface, Operation, _IRNode, ABC, object

A two-level rectangular pulse with a high-amplitude setup portion followed by a lower-amplitude hold portion.

Example of how this looks in textual MLIR:

%width = pulse.constant<128e-9> : !pulse.time
%amplitude = pulse.constant<0.5> : !pulse.amplitude
%setup = arith.constant<0.5> : !f64
%fractional_rise = arith.constant<0.1> : !f64
%waveform = pulse.setup_hold_waveform(%width, %amplitude, %setup, %fractional_rise)
    : !pulse.waveform
Variables:
  • width – The total duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude – The amplitude of the hold portion of the waveform, represented as a SSA value of type pulse.amplitude.

  • setup – Relative setup amplitude with respect to the hold segment amplitude.

  • fractional_rise – Fraction of width occupied by the setup segment.

  • result – The SSA value representing the resulting setup-hold waveform, which can be used as an operand in later operations.

Parameters:
  • width (SSAValue | Operation) – The total duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude (SSAValue | Operation) – The amplitude of the hold portion of the waveform, represented as a SSA value of type pulse.amplitude.

  • setup (SSAValue | Operation) – Relative setup amplitude.

  • fractional_rise (SSAValue | Operation) – Fraction of width occupied by the setup segment.

WAVEFORM_NAME: ClassVar[str] = 'setup_hold'

The string representation of the waveform which acts as a hook for waveform information that lives outside the IR.

amplitude

Access a non-variadic construct which appears before any variadic arguments.

attributes: dict[str, Attribute]

The attributes attached to the operation.

build_shape()

Build the waveform shape for this op from shape-specific operands.

Amplitude, duration, and DRAG coefficients are handled by the waveform evaluation pass. Returns None if any shape-defining operand is not a compile-time constant.

Returns:

The waveform shape instance, or None if it cannot be built.

property drag_coefficients: tuple[SSAValue, ...]

Optional DRAG coefficient operands for this waveform.

fractional_rise

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.setup_hold_waveform'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

setup

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
width

Access a non-variadic construct which appears before any variadic arguments.

class SinusoidalWaveformOp(width, amplitude, number_of_periods, internal_phase, *drag_coefficients)

Bases: SinusoidalWaveformOp, IRDLOperation, IsAnalyticalWaveformInterface, Operation, _IRNode, ABC, object

A sinusoidal waveform shape.

Example of how this looks in textual MLIR:

%width = pulse.constant<128e-9> : !pulse.time
%amplitude = pulse.constant<0.5> : !pulse.amplitude
%number_of_periods = arith.constant<0.5> : !f64
%internal_phase = pulse.constant<1.5708> : !pulse.phase
%waveform = pulse.sinusoidal_waveform(
    %width, %amplitude, %number_of_periods, %internal_phase
)
    : !pulse.waveform
Variables:
  • width – The duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude – The amplitude of the waveform, represented as a SSA value of type pulse.amplitude.

  • number_of_periods – Number of periods across the normalized waveform domain.

  • internal_phase – The internal phase offset of the waveform, represented as a SSA value of type pulse.phase.

  • result – The SSA value representing the resulting sinusoidal waveform.

Parameters:
  • width (SSAValue | Operation) – The duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude (SSAValue | Operation) – The amplitude of the waveform, represented as a SSA value of type pulse.amplitude.

  • number_of_periods (SSAValue | Operation) – Number of periods across the waveform.

  • internal_phase (SSAValue | Operation) – The internal phase offset of the waveform, represented as a SSA value of type pulse.phase.

WAVEFORM_NAME: ClassVar[str] = 'sinusoidal'

The string representation of the waveform which acts as a hook for waveform information that lives outside the IR.

amplitude

Access a non-variadic construct which appears before any variadic arguments.

attributes: dict[str, Attribute]

The attributes attached to the operation.

build_shape()

Build the waveform shape for this op from shape-specific operands.

Amplitude, duration, and DRAG coefficients are handled by the waveform evaluation pass. Returns None if any shape-defining operand is not a compile-time constant.

Returns:

The waveform shape instance, or None if it cannot be built.

drag_coefficients

Access a variadic construct in the case where it is the only variadic.

classmethod get_irdl_definition()

Get the IRDL operation definition.

internal_phase

Access a non-variadic construct which appears before any variadic arguments.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.sinusoidal_waveform'

The operation name. Should be a static member of the class

number_of_periods

Access a non-variadic construct which appears before any variadic arguments.

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
width

Access a non-variadic construct which appears before any variadic arguments.

class SoftSquareWaveformOp(width, amplitude, fractional_top_width, fractional_rise, regularize, *drag_coefficients)

Bases: SoftSquareWaveformOp, IRDLOperation, IsAnalyticalWaveformInterface, Operation, _IRNode, ABC, object

A soft-square waveform shape with explicit normalized shape parameters.

This op matches SoftSquareWaveformShape by exposing fractional_top_width, fractional_rise, and regularize directly.

Example of how this looks in textual MLIR:

%width = pulse.constant<128e-9> : !pulse.time
%amplitude = pulse.constant<0.5> : !pulse.amplitude
%fractional_top_width = arith.constant<0.5> : !f64
%fractional_rise = arith.constant<0.1> : !f64
%waveform = pulse.soft_square_waveform<false>(
    %width, %amplitude, %fractional_top_width, %fractional_rise
) : !pulse.waveform
Variables:
  • width – The duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude – The amplitude of the waveform, represented as a SSA value of type pulse.amplitude.

  • fractional_top_width – Flat-top proportion in normalized units.

  • fractional_rise – Combined rise+fall proportion in normalized units.

  • regularize – Whether to make the envelope zero at the edges and one at the peak.

  • result – The SSA value representing the resulting softened square waveform, which can be used as an operand in later operations.

Parameters:
  • width (SSAValue | Operation) – The duration of the waveform, represented as a SSA value of type pulse.time.

  • amplitude (SSAValue | Operation) – The amplitude of the waveform, represented as a SSA value of type pulse.amplitude.

  • fractional_top_width (SSAValue | Operation) – Flat-top proportion in normalized units.

  • fractional_rise (SSAValue | Operation) – Rise and fall width proportion in normalized units.

  • regularize (Union[bool, IntegerAttr[IntegerType]]) – Whether to normalize the shape to zero at edges.

WAVEFORM_NAME: ClassVar[str] = 'soft_square'

The string representation of the waveform which acts as a hook for waveform information that lives outside the IR.

amplitude

Access a non-variadic construct which appears before any variadic arguments.

attributes: dict[str, Attribute]

The attributes attached to the operation.

build_shape()

Build the waveform shape for this op from shape-specific operands.

Amplitude, duration, and DRAG coefficients are handled by the waveform evaluation pass. Returns None if any shape-defining operand is not a compile-time constant.

Returns:

The waveform shape instance, or None if it cannot be built.

drag_coefficients

Access a variadic construct in the case where it is the only variadic.

fractional_rise

Access a non-variadic construct which appears before any variadic arguments.

fractional_top_width

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.soft_square_waveform'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

regularize

Accessor for an operation property.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
width

Access a non-variadic construct which appears before any variadic arguments.

class SquareWaveformOp(width, amplitude)

Bases: SquareWaveformOp, IRDLOperation, IsAnalyticalWaveformInterface, Operation, _IRNode, ABC, object

Represents a square waveform, defined by its duration and amplitude.

Example of how this looks in textual MLIR:

%duration = pulse.constant<128e-9> : !pulse.time
%amplitude = pulse.constant<0.5> : !pulse.amplitude
%waveform = pulse.square_waveform(%duration, %amplitude) : !pulse.waveform
Variables:
  • width – The duration of the square waveform, represented as a SSA value of type pulse.time.

  • amplitude – The amplitude of the square waveform, represented as a SSA value of type pulse.amplitude.

  • result – The SSA value representing the resulting square waveform, which can be used as an operand in later operations.

Parameters:
  • width (SSAValue | Operation) – The duration of the square waveform, represented as a SSA value of type pulse.time.

  • amplitude (SSAValue | Operation) – The amplitude of the square waveform, represented as a SSA value of type pulse.amplitude.

WAVEFORM_NAME: ClassVar[str] = 'square'

The string representation of the waveform which acts as a hook for waveform information that lives outside the IR.

amplitude

Access a non-variadic construct which appears before any variadic arguments.

attributes: dict[str, Attribute]

The attributes attached to the operation.

build_shape()

Build the waveform shape for this op from shape-specific operands.

Amplitude, duration, and DRAG coefficients are handled by the waveform evaluation pass. Returns None if any shape-defining operand is not a compile-time constant.

Returns:

The waveform shape instance, or None if it cannot be built.

property drag_coefficients: tuple[SSAValue, ...]

Optional DRAG coefficient operands for this waveform.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.square_waveform'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
width

Access a non-variadic construct which appears before any variadic arguments.

class StartContinuousWaveformOp(frame, amplitude)

Bases: StartContinuousWaveformOp, IRDLOperation, Operation, _IRNode, ABC, object

Represents the start of a continuous waveform, which is a waveform that is played indefinitely until a corresponding stop operation is reached.

Example of how this looks in textual MLIR, paired with StopContinuousWaveformOp:

%frame = pulse.create_frame(%frequency) : !pulse.frame<"channel_1">
%amplitude = pulse.constant<0.5> : !pulse.amplitude
%frame2 = pulse.start_continuous_waveform(%frame, %amplitude) : !pulse.frame<"channel_1">
%duration = pulse.constant<800e-9> : !pulse.time
%frame3 = pulse.wait(%frame2, %duration) : !pulse.frame<"channel_1">
%frame4 = pulse.stop_continuous_waveform(%frame3) : !pulse.frame<"channel_1">
Variables:
  • frame – The SSA value representing the frame on which to start the continuous waveform.

  • amplitude – The SSA value representing the amplitude of the continuous waveform, of type pulse.amplitude.

  • result – The SSA value representing the resulting frame after starting the continuous waveform, which can be used as an operand in later operations.

Parameters:
  • frame (SSAValue | Operation) – The SSA value representing the frame on which to start the continuous waveform.

  • amplitude (SSAValue | Operation) – The SSA value representing the amplitude of the continuous waveform, of type pulse.amplitude.

amplitude

Access a non-variadic construct which appears before any variadic arguments.

attributes: dict[str, Attribute]

The attributes attached to the operation.

frame

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.start_continuous_waveform'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
class StateMapOp(value, mapping)

Bases: StateMapOp, IRDLOperation, Operation, _IRNode, ABC, object

Maps a state key to a binary value.

The state key is a value determined from state discrimination, which reveals information about the qubit state after a readout, but might not directly tell you the exact state of the qubit. In the circuit model of quantum computing, we work in the language of binary values, which represent the logical states of a given qubit basis. The mapping operator acts as a bridge between an arbitrary state discrimination to a binary value.

Variables:
  • value – The operand that carries the discriminated state type.

  • mapping – The attribute that carries the mapping from discriminated state type to a binary value.

  • result – The mapped binary result.

Parameters:
  • value (Union[SSAValue[StateKeyType], Operation]) – The SSA value representing the state key to be mapped.

  • mapping (StateMapDictAttr | Mapping[int, int]) – The state mapping attribute that defines the mapping from state keys to binary values.

attributes: dict[str, Attribute]

The attributes attached to the operation.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

mapping

Accessor for an operation property.

name: ClassVar[str] = 'pulse.state_map'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

value

Access a non-variadic construct which appears before any variadic arguments.

verify_()

Verifies that each state in the state type is represented in the state map.

class StopContinuousWaveformOp(frame)

Bases: StopContinuousWaveformOp, IRDLOperation, Operation, _IRNode, ABC, object

Represents stopping a continuous waveform, which is a waveform that is played indefinitely until a corresponding stop operation is reached. Paired with StartContinuousWaveformOp.

Variables:
  • frame – The SSA value representing the frame on which to stop the continuous waveform.

  • result – The SSA value representing the resulting frame after stopping the continuous waveform, which can be used as an operand in later operations.

Parameters:

frame (SSAValue | Operation) – The SSA value representing the frame on which to stop the continuous waveform.

attributes: dict[str, Attribute]

The attributes attached to the operation.

frame

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.stop_continuous_waveform'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
class SubOp(lhs, rhs, result_type)

Bases: InternalBinaryOp[PULSE_VAR_TYPE], Generic[PULSE_VAR_TYPE]

Represents subtraction of two values of the same types, including frequencies, phases, durations, amplitudes and waveforms.

Example of how this looks in textual MLIR:

%frequency1 = pulse.constant<5e9> : !pulse.frequency
%frequency2 = pulse.constant<1e9> : !pulse.frequency
%result = pulse.sub(%frequency1, %frequency2) : !pulse.frequency
Variables:
  • lhs – The left-hand side operand of the subtraction operation.

  • rhs – The right-hand side operand of the subtraction operation.

  • result – The SSA value representing the result of the subtraction operation, which can be used as an operand in later operations.

Parameters:
attributes: dict[str, Attribute]

The attributes attached to the operation.

classmethod get_irdl_definition()

Get the IRDL operation definition.

lhs

Access a non-variadic construct which appears before any variadic arguments.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.sub'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

static py_operation(lhs, rhs)

Performs the subtraction operation on given literals.

This is used for constant folding.

result

Access a non-variadic construct which appears before any variadic arguments.

rhs

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
class SynchronizeOp(*frames)

Bases: SynchronizeOp, IRDLOperation, Operation, _IRNode, ABC, object

Synchronizes a set of frames, ensuring they all progress to the same time.

This is used to ensure operations on different frames are correctly synchronized in time.

Example of how this looks in textual MLIR:

%frame1 = pulse.create_frame(%frequency1) : !pulse.frame<"channel_1">
%frame2 = pulse.create_frame(%frequency2) : !pulse.frame<"channel_2">
%frame3, %frame4 = pulse.sync(%frame1, %frame2)
    : (!pulse.frame<"channel_1">, !pulse.frame<"channel_2">)
Variables:
  • frames – A list of SSA values representing the frames to be synchronized.

  • result – A list of SSA values representing the resulting synchronized frames, which can be used as operands in later operations. The order of the results corresponds to the order of the input frames.

Parameters:

frames (SSAValue | Operation) – A variable number of SSA values representing the frames to be synchronized.

attributes: dict[str, Attribute]

The attributes attached to the operation.

frames

Access a variadic construct in the case where it is the only variadic.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.sync'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a variadic construct in the case where it is the only variadic.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify()

Verifies that at least two frames are being synchronized, and that the number of results matches the number of operands.

verify_()
class WaitOp(frame, duration)

Bases: WaitOp, IRDLOperation, Operation, _IRNode, ABC, object

Progresses time on a given frame by a specified amount, without playing any waveform.

This is used to ensure waveforms are played at the correct time.

Example of how this looks in textual MLIR:

%frame = pulse.create_frame(%frequency) : !pulse.frame<"channel_1">
%frame2 = pulse.wait(%frame, %duration) : !pulse.frame<"channel_1">

Note

In older versions of QAT-IR, this operation was called “Delay”.

Variables:
  • frame – The SSA value representing the frame on which to wait.

  • duration – The SSA value representing the amount of time to wait, of type pulse.time.

  • result – The SSA value representing the resulting frame after waiting, which can be used as an operand in later operations.

Parameters:
  • frame (SSAValue | Operation) – The SSA value representing the frame on which to wait.

  • duration (SSAValue | Operation) – The SSA value representing the amount of time to wait, of type pulse.time.

attributes: dict[str, Attribute]

The attributes attached to the operation.

duration

Access a non-variadic construct which appears before any variadic arguments.

frame

Access a non-variadic construct which appears before any variadic arguments.

classmethod get_irdl_definition()

Get the IRDL operation definition.

location: LocationAttr

The source location attached to this operation.

name: ClassVar[str] = 'pulse.wait'

The operation name. Should be a static member of the class

properties: dict[str, Attribute]

The properties attached to the operation. Properties are inherent to the definition of an operation’s semantics, and thus cannot be discarded by transformations.

result

Access a non-variadic construct which appears before any variadic arguments.

traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>

Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.

verify_()
extract_constant_scalar(ssa)

Return the Python scalar behind ssa if it is a compile-time constant.

Handles both pulse-dialect ConstantOp values (which fold to a PulseNumericTypedAttr) and standard arith.constant values (which fold to a FloatAttr). Returns None otherwise.

Complex values whose imaginary part is exactly zero are narrowed to float, so waveform fields typed strictly as float accept scalars extracted from an AmplitudeAttr, which always stores its literal value as complex.

Return type:

float | complex | None