qat.experimental.dialect.pulse.ir package

The Pulse dialect represents the operation set to interact with quantum mechanical systems through microwave interactions.

It is modelled by waveforms that are used to drive the systems, and can be captured as a response from the systems. Pulses must be played down a reference frame, which encodes a frequency that typically matches some resonant frequency of the system. The frame tracks phase accumulations, including offsets from explicit phase manipulation instructions. They also implicitly track time, as pulse interactions must be played at the right time.

The dialect includes a number of operations to define waveforms and related properties, and arithmetic on those types. The waveforms and related types are used to manipulate the state of a frame, and play / acquire waveforms on a port in that reference frame.

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.

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.

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

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

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 AcquisitionType(*parameters)

Bases: AcquisitionType

Represents an acquisition type.

Abstractly this represents the acquisition signal result for a given duration from an acquire operation, which we can do further processing on, such as integration to map it to an IQ value, or addition with other acquisition signals to achieve shot-averaged time-series data.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

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

The attribute name should be a static field in the attribute classes.

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:
classmethod get_irdl_definition()

Get the IRDL operation definition.

lhs

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

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

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

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 AdvancesTimeTrait

Bases: OpTrait

A trait that signifies an operation advances time on the frame(s) it acts on.

The time does not need to be known at compile time, and in that sense, can be runtime dynamic.

class AmplitudeAttr(value)

Bases: PulseNumericTypedAttr[AmplitudeType]

An attribute that represents a compile-time constant amplitude.

Variables:
  • real – The real part of the amplitude, which is expected to be a float representing the amplitude in arbitrary units.

  • imag – The imaginary part of the amplitude, which is expected to be a float representing the amplitude in arbitrary units, and defaults to 0.0 if not provided.

Parameters:

value (complex | float) – The amplitude value, which can be a complex number or a float. If a float is provided, the imaginary part is set to 0.0.

property associated_type: type[AmplitudeType]

Returns the associated dialect type.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

imag: FloatData
property literal_value: complex

Returns the amplitude value as a complex number.

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

The attribute name should be a static field in the attribute classes.

real: FloatData
class AmplitudeType(*parameters)

Bases: AmplitudeType

A type representing an amplitude value, used for expressing the amplitude of pulse channels.

The value is expected to be a floating-point number representing the amplitude in arbitrary units.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

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

The attribute name should be a static field in the attribute classes.

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.

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.

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

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

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.

callee

Accessor for an operation property.

classmethod get_irdl_definition()

Get the IRDL operation definition.

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

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

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 CallKernelOpUserOpInterface

Bases: SymbolUserOpInterface

Symbol-user trait for call operations that target kernels.

Inheriting SymbolUserOpInterface registers the operation as a symbol user. This trait also verifies that the resolved callee is a KernelOp and that call operand/result signatures match the referenced kernel function type.

verify(op)

Verify symbol resolution and signature compatibility for a kernel call.

class ComplexData(data)

Bases: Data[complex]

Store a Pythonic complex data type.

Comparatively to the complex.ComplexNumberAttr type, this data object can store a Pythonic complex number without having to specify bitwidth (with its counterpart also breaking it up into two real components). This is analogous to the FloatData, which allows us to specify floats without specifying bitwidth. For the high level of abstraction targeted by the pulse dialect, we do not need to specify details like bitwidth, as this is specified when lowering to lower levels, be it a classical CPU, or quantum control system.

Note

This data type is specified in the absence of an existing one in xDSL. If that changes in the future, this type would be marked for deprecation.

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

The attribute name should be a static field in the attribute classes.

classmethod parse_parameter(parser)

Parses the parameter represented as a string into a complex number.

Return type:

complex

print_parameter(printer)

Prints the complex parameter, representing the real and imaginary components as a two-element tuple.

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:
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.

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

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

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.

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.

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.

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.

classmethod get_irdl_definition()

Get the IRDL operation definition.

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

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

policy

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.

value

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

verify_()

Verifies that the result state type matches the attached policy.

class DiscriminatorPolicyAttr(*parameters)

Bases: ParametrizedAttribute, ABC

Parent class for all discriminator policies, which are used to determine how to process IQ values.

State labels are non-negative integers, with the exception of -1, which is reserved for representing an unmapped state, such as IQ values which cannot be confidently mapped to any state.

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

The attribute name should be a static field in the attribute classes.

abstract property state_range: tuple[int, int]

Returns the range of state labels that the discriminator policy can discriminate between.

class EqualiseAttr(linear_coefficient, conjugate_coefficient, translation)

Bases: EqualiseAttr

An attribute that represents an affine transformation, used as part of the post- processing pipeline for acquired signals.

In a complex space, an affine transformation of a complex number z can be represented as:

\[z' = a * z + b * conj(z) + c\]

where:

  • \(a\) is the (complex) linear coefficient,

  • \(b\) is the (complex) conjugate coefficient,

  • \(c\) is the (complex) translation.

If we consider this from a two-dimensional real space perspective, we can represent the affine transformation as

\[z' = A * z + C\]

where A is an arbitrary 2x2 real matrix representing the linear transformation, and C is an arbitrary 2D real vector representing the translation.

This attribute stores the transformation using the three complex numbers to be consistent with the complex representation of the IQ space. However, it offers utilities to expose the transformation in a real space representation, and also build from it. This allows a compact representation that is consistent with legacy PuRR linear_map_complex_to_real, and also the more generalised affine transformations defined in pydantic pipelines.

Parameters:
  • linear_coefficient (ComplexData | complex) – The (complex) linear coefficient.

  • conjugate_coefficient (ComplexData | complex) – The (complex) conjugate coefficient.

  • translation (ComplexData | complex) – The (complex) translation.

conjugate_coefficient: ComplexData
classmethod from_real_space(linear_matrix, translation_vector)

Creates an EqualiseAttr from a real space representation.

Parameters:
  • linear_matrix (ndarray[float64]) – A 2x2 real matrix representing the linear transformation.

  • translation_vector (ndarray[float64]) – A 2D real vector representing the translation.

Return type:

EqualiseAttr

Returns:

An instance of EqualiseAttr.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

linear_coefficient: ComplexData
property linear_matrix: ndarray[float64]

Returns the linear transformation matrix in real space representation.

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

The attribute name should be a static field in the attribute classes.

translation: ComplexData
property translation_vector: ndarray[float64]

Returns the translation vector in real space representation.

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.

classmethod get_irdl_definition()

Get the IRDL operation definition.

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

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

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 FrameCanonicalizationPatternsTrait

Bases: HasCanonicalizationPatternsTrait

Applies canonicalization to operations that act on frames.

Including:

  • Phase shifts that are modulo 2pi equal to zero.

  • Waits that are equal to zero.

classmethod get_canonicalization_patterns()
Return type:

tuple[RewritePattern, ...]

class FrameType(port)

Bases: FrameType

Represents a reference frame for a quantum system, encoding a frequency, and tracks phase and time evolution relative to that frequency.

Used with the intent of manipulating a quantum component.

Variables:

port – A target-resolved token used to identify the port for this frame, without encoding hardware object details directly in the IR. This name can take any string, but is expected to match a meaningful port in the context of the system data.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

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

The attribute name should be a static field in the attribute classes.

port: StringAttr = <xdsl.irdl.attributes._ParameterDef object>
class FrequencyAttr(value, unit=FrequencyUnits.HERTZ)

Bases: PulseNumericTypedAttr[FrequencyType]

An attribute that represents a compile-time constant frequency.

Variables:
  • value – The frequency value, which can be a float or an integer.

  • unit – The frequency units, which is an instance of the FrequencyUnits enum.

Parameters:
  • value (float | int) – The frequency value in Hz, which can be a float or an integer.

  • unit (FrequencyUnits) – The frequency units, which is an instance of the FrequencyUnits, enum and defaults to hertz if not provided.

property associated_type: type[FrequencyType]

Returns the associated dialect type.

classmethod from_literal_value(value, unit=FrequencyUnits.HERTZ)

Creates a frequency attribute from a canonical value in Hertz.

Parameters:
  • value (float | int) – The frequency value in Hertz.

  • unit (FrequencyUnits) – The unit used to store the value.

Return type:

FrequencyAttr

Returns:

A frequency attribute storing value in the requested unit.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

property literal_value: float | int

Returns the frequency value in Hertz.

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

The attribute name should be a static field in the attribute classes.

unit: FrequencyUnitsData
value: FloatData | IntAttr
class FrequencyType(*parameters)

Bases: FrequencyType

A type representing a frequency value, used for expressing frequencies of pulse channels.

The value is expected to be a floating-point number representing the frequency in Hz.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

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

The attribute name should be a static field in the attribute classes.

class FrequencyUnitsData(data)

Bases: Data[FrequencyUnits]

Data attribute for representing frequency units in the pulse dialect.

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

The attribute name should be a static field in the attribute classes.

classmethod parse_parameter(parser)

Parses the parameters of the attribute, which are expected to be a string representing the frequency units.

Return type:

FrequencyUnits

print_parameter(printer)

Prints the parameters of the attribute, which are expected to be a string representing the frequency units.

Return type:

None

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.

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.

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

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

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.

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.

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

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

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 IQResultType(*parameters)

Bases: IQResultType

Represents an IQ result type.

This type exists instead of using the builtin complex type to allow for a more explicit representation of IQ values acquired from a quantum system, and to avoid hardware- specific typing details leaking into the IR. In practice, this can be treated as a complex number.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

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

The attribute name should be a static field in the attribute classes.

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.

classmethod get_irdl_definition()

Get the IRDL operation definition.

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

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

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:
lhs = <xdsl.irdl.operations._OperandFieldDef object>
result = <xdsl.irdl.operations._ResultFieldDef object>
rhs = <xdsl.irdl.operations._OperandFieldDef object>
verify()

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

class IsAnalyticalWaveformInterface(*, operands=(), result_types=(), properties={}, attributes={}, location=None, successors=(), regions=())

Bases: Operation, ABC

Marks operations that produce waveforms via an analytical definition.

Operations implementing this interface know how to construct the WaveformShape they represent from their own shape-specific operands and properties.

WAVEFORM_NAME: ClassVar[str]

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

abstract property amplitude: SSAValue

The amplitude of the waveform produced by this operation.

abstract 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.

Return type:

WaveformShape | None

Returns:

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

abstract property drag_coefficients: tuple[SSAValue, ...]

Optional DRAG coefficient operands for this waveform.

abstract property width: SSAValue

The width of the waveform produced by this operation.

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.

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.

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

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

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.

classmethod get_irdl_definition()

Get the IRDL operation definition.

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

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

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 MaximumLikelihoodPolicyAttr(state_centers, noise_estimate=1.0, p_min=0.0)

Bases: MaximumLikelihoodPolicyAttr

A discriminator policy that discriminates between multiple states based on a maximum likelihood approach.

State labels are non-negative integers, each mapping to a center represented by a complex number. Every IQ point can be assigned to the state label k with the highest normalised likelihood:

\[\tilde{p}_k(z) = \frac{L_k(z)}{\sum_j L_j(z)}, \quad L_k(z) = \exp\!\left(-\frac{|z - \mathrm{loc}_k|^2}{2\,\nu}\right)\]

where \(\nu\) is the noise power (variance) noise_est.

If the maximum likelihood is below a threshold p_min, the IQ point is assigned to the state -1 (unmapped).

Variables:
  • state_centers – A list of the different state centers which map respectively to their state labels, which are ordered from 0 to len(state_centers) - 1. Each center is represented by a complex number.

  • noise_estimate – The noise power (variance) of the IQ values.

  • p_min – The minimum normalised likelihood required to assign an IQ point to a state label. If the maximum normalised likelihood is below this threshold, the IQ point is assigned to the state -1 (unmapped).

Parameters:
  • state_centers (Iterable[complex | ComplexData]) – A list of the different state centers which map respectively to their state labels, which are ordered from 0 to len(state_centers) - 1. Each center is represented by a complex number.

  • noise_estimate (float) – The noise power (variance) of the IQ values. Defaults to 1.0 if not provided. Noise estimate is only important if p_min is set to a value greater than 0.0, as it is used to calculate the normalised likelihoods of the IQ points. If p_min is set to 0.0, the noise estimate is ignored.

  • p_min (float) – The minimum normalised likelihood required to assign an IQ point to a state label. If the maximum normalised likelihood is below this threshold, the IQ point is assigned to the state -1 (unmapped).

POLICY_NAME: ClassVar[str] = 'maximum_likelihood'
classmethod get_irdl_definition()

Get the IRDL attribute definition.

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

The attribute name should be a static field in the attribute classes.

noise_estimate: FloatData
p_min: FloatData
state_centers: ArrayAttr[ComplexData]
property state_range: tuple[int, int]

The range of state labels that the discriminator policy can discriminate between.

verify()

Validates the properties of the maximum likelihood policy attribute.

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.

classmethod get_irdl_definition()

Get the IRDL operation definition.

lhs

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

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

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

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:
classmethod get_irdl_definition()

Get the IRDL operation definition.

lhs

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

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

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

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 NumericArrayData(data)

Bases: Data[ndarray[complexfloating]]

Stores numeric arrays for use in attributes.

Manipulations of sampled waveforms and weight vectors are processed using numpy due to its performance, and for this reason, we store this data as a numpy array.

To be future thinking, and compatible with integrations with MLIR in the future, we print and parse the data as a list of builtin attributes, with the conversion handled in the interface.

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

The attribute name should be a static field in the attribute classes.

classmethod parse_parameter(parser)

Parses the parameters of the attribute, which are expected to be a list of builtin complex attributes representing elements within the array.

Return type:

ndarray[complex128]

print_parameter(printer)

Prints the parameters as textual MLIR, which are provided as complex attributes in a list.

Return type:

None

class PhaseAttr(value)

Bases: PulseNumericTypedAttr[PhaseType]

An attribute that represents a compile-time constant phase. Phases are represented by radians.

Variables:

value – The phase value, which is expected to be a float representing the phase in radians.

Parameters:

value (float) – The phase value in radians, represented as a float.

property associated_type: type[PhaseType]

Returns the associated dialect type.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

property literal_value: float

Returns the phase value.

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

The attribute name should be a static field in the attribute classes.

value: FloatData
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.

frame = <xdsl.irdl.operations._OperandFieldDef object>
abstract property name: str

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

phase = <xdsl.irdl.operations._OperandFieldDef object>
result = <xdsl.irdl.operations._ResultFieldDef object>
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.

frame

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

classmethod get_irdl_definition()

Get the IRDL operation definition.

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.

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.

frame

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

classmethod get_irdl_definition()

Get the IRDL operation definition.

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.

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 PhaseType(*parameters)

Bases: PhaseType

A type representing a phase value, typically used for phase manipulations.

The value is expected to be a floating-point number representing the angle in radians.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

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

The attribute name should be a static field in the attribute classes.

class PulseNumericTypedAttr(*parameters)

Bases: ParametrizedAttribute, Generic[PULSE_VAR_TYPE], ABC

Base class for attributes in the pulse dialect that have a type associated with them.

This is used to group together attributes that represent typed values, such as frequencies, phases, times and amplitudes.

abstract property associated_type: type[PULSE_VAR_TYPE]

Returns the type that is associated with this attribute, which is specified by the concrete subclass.

abstract property literal_value: Number

Converts the attribute to a literal value, which is returned as a numeric value, and specified by the concrete subclass.

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.

frame

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

classmethod get_irdl_definition()

Get the IRDL operation definition.

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

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

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 PulseTypesCanonicalizationPatternsTrait

Bases: HasCanonicalizationPatternsTrait

Applied to arithmetic binary operations on types in the pulse dialect that resemble floating point or complex numbers.

classmethod get_canonicalization_patterns()
Return type:

tuple[RewritePattern, ...]

class RealThresholdPolicyAttr(threshold=0.0)

Bases: RealThresholdPolicyAttr

A discriminator policy that discriminates between two states based on a real threshold.

The discriminator works by mapping the IQ values to states {0, 1} according to the classifier

\[\begin{split}\text{state}(z) = \begin{cases} 0 & \text{if } \Re(z) < \text{threshold} \\ 1 & \text{if } \Re(z) \geq \text{threshold} \end{cases}\end{split}\]
Variables:

threshold – The threshold value, which is used to determine the state of the IQ value.

Parameters:

threshold (float) – The threshold value, which is used to determine the state of the IQ value.

POLICY_NAME: ClassVar[str] = 'real_threshold'
classmethod get_irdl_definition()

Get the IRDL attribute definition.

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

The attribute name should be a static field in the attribute classes.

property state_range: tuple[int, int]

The range of state labels that the discriminator policy can discriminate between.

threshold: FloatData
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.

classmethod get_irdl_definition()

Get the IRDL operation definition.

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

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

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.

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.

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

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

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 SampledWaveformAttr(samples, width, sample_time)

Bases: PulseNumericTypedAttr[WaveformType]

An attribute that represents a sampled waveform, which is represented by a real or complex numpy array.

Parameters:
  • samples (ndarray[complex] | list[complex]) – The samples of the waveform, represented as a numpy array or a list of floats or complex numbers.

  • width (TimeAttr) – The total width of the waveform, represented as a TimeAttr.

  • sample_time (TimeAttr) – The time between samples, represented as a TimeAttr.

property associated_type: type[WaveformType]

Returns the associated dialect type.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

property literal_value: ndarray

Returns the samples of the waveform as a numpy array.

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

The attribute name should be a static field in the attribute classes.

sample_time: TimeAttr
samples: NumericArrayData
verify()

Check that the attribute parameters satisfy the expected invariants. Raise a VerifyException otherwise.

Return type:

None

width: TimeAttr
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:
classmethod get_irdl_definition()

Get the IRDL operation definition.

lhs

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

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

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

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.

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.

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

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

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.

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.

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

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

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.

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.

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.

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.

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.

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

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

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.

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.

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

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

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.

frame

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

classmethod get_irdl_definition()

Get the IRDL operation definition.

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

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

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 StateKeyType(min_state, max_state)

Bases: StateKeyType

Represents a discriminated state key type with integer labels between inclusive bounds.

This type is the result of state discrimination, which maps IQ values from qubit readout to integer state identifiers. The bounds encode the valid range of state labels that can be produced by a discrimination policy. For example:

  • A real-threshold discriminator produces states {0, 1}

  • A maximum-likelihood discriminator produces states {-1, 0, …, n-1}, where -1 represents an unmapped/ambiguous state

The parametrized bounds enable compile-time verification that downstream operations (like state mapping) cover all possible state outcomes.

Variables:
  • min_state – The smallest allowed integer state label (inclusive).

  • max_state – The largest allowed integer state label (inclusive).

classmethod get_irdl_definition()

Get the IRDL attribute definition.

max_state: IntAttr = <xdsl.irdl.attributes._ParameterDef object>
min_state: IntAttr = <xdsl.irdl.attributes._ParameterDef object>
name: ClassVar[str] = 'pulse.state'

The attribute name should be a static field in the attribute classes.

classmethod parse_parameters(parser)

Parse the attribute parameters.

Return type:

list[IntAttr]

print_parameters(printer)

Print the attribute parameters.

Return type:

None

property state_range: tuple[int, int]

Returns the valid range of state labels as a (min, max) tuple.

All integers in this range (inclusive) are valid state identifiers produced by the associated discrimination policy. Used for verification that state mapping operations cover all possible outcomes.

verify()

Check that the attribute parameters satisfy the expected invariants. Raise a VerifyException otherwise.

Return type:

None

class StateMapDictAttr(data)

Bases: Data[immutabledict[int, IntAttr]]

An attribute that represents a mapping from integer state labels to integer data, which for example, could be another state label, or a binary value.

The expected use cases are for mapping state labels from state discrimination onto binary outputs.

Initializes the state map dictionary attribute.

Parameters:

data (Mapping[int, IntAttr | int]) – A mapping from integer state labels to integer attributes associated with those states.

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

The attribute name should be a static field in the attribute classes.

classmethod parse_parameter(parser)

Parses the parameters of the attribute, which are expected to be a dictionary representing the state mapping.

Return type:

immutabledict[int, IntAttr]

print_parameter(printer)

Prints the parameters of the attribute, which are expected to be a dictionary representing the state mapping.

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.

classmethod get_irdl_definition()

Get the IRDL operation definition.

mapping

Accessor for an operation property.

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

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

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.

frame

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

classmethod get_irdl_definition()

Get the IRDL operation definition.

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

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

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:
classmethod get_irdl_definition()

Get the IRDL operation definition.

lhs

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

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

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

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.

frames

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

classmethod get_irdl_definition()

Get the IRDL operation definition.

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

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

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 TimeAttr(value, unit=TimeUnits.SECOND)

Bases: PulseNumericTypedAttr[TimeType]

An attribute that represents a compile-time constant time.

This attribute intentionally does not specify the precision of the time value, and uses the standard Python precision for its respective type. The representation of the value will be set by the target.

Variables:
  • value – The time value, which can be a float or an integer.

  • unit – The time units, which is an instance of the TimeUnits enum.

Parameters:
  • value (float | int) – The time value in seconds, which can be a float or an integer.

  • unit (TimeUnits) – The time units, which is an instance of the TimeUnits enum and defaults to seconds if not provided.

property associated_type: type[TimeType]

Returns the associated dialect type.

classmethod from_literal_value(value, unit=TimeUnits.SECOND)

Creates a time attribute from a canonical value in seconds.

Parameters:
  • value (float | int) – The time value in seconds.

  • unit (TimeUnits) – The unit used to store the value.

Return type:

TimeAttr

Returns:

A time attribute storing value in the requested unit.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

property literal_value: float | int

Returns the time value in seconds.

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

The attribute name should be a static field in the attribute classes.

unit: TimeUnitsData
value: FloatData | IntAttr
value_in_unit(unit)

Returns the time value in the specified units.

Parameters:

unit (TimeUnits) – The units to convert the time value to.

Return type:

float | int

Returns:

The time value in the specified units.

class TimeType(*parameters)

Bases: TimeType

Represents a time value, used for expressing durations of operations on frames.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

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

The attribute name should be a static field in the attribute classes.

class TimeUnitsData(data)

Bases: Data[TimeUnits]

Data attribute for representing time units in the pulse dialect.

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

The attribute name should be a static field in the attribute classes.

classmethod parse_parameter(parser)

Parses the parameters of the attribute, which are expected to be a string representing the time units.

Return type:

TimeUnits

print_parameter(printer)

Prints the parameters of the attribute, which are expected to be a string representing the time units.

Return type:

None

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.

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.

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

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

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 WaveformType(*parameters)

Bases: WaveformType

Represents a waveform type.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

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

The attribute name should be a static field in the attribute classes.

class WeightsAttr(weights)

Bases: WeightsAttr

An attribute that represents a set of weights that can be used in demodulation.

This is expected to be optionally attached to acquire operations.

Variables:

weights – The weights, represented as a numpy array of complex values.

Parameters:

weights (ndarray[complexfloating] | list[complex | float]) – The weights, represented as a numpy array or a list of complex values.

classmethod get_irdl_definition()

Get the IRDL attribute definition.

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

The attribute name should be a static field in the attribute classes.

verify()

Check that the attribute parameters satisfy the expected invariants. Raise a VerifyException otherwise.

Return type:

None

weights: NumericArrayData

Submodules