qat.experimental.dialect.pulse.transforms.waveform_evaluation module
Pass that evaluates analytical waveform ops into constant sampled waveforms.
This is the xDSL-canonical counterpart of
EvaluateWaveforms. It walks every
IsAnalyticalWaveformInterface op in the module and, when the op has only
compile-time-constant operands, replaces it with one or more
ConstantOps carrying a
SampledWaveformAttr.
The pass looks at every PulseOp that
consumes the analytical waveform and groups them by the sample time associated with
their frame’s port kind. A single ConstantOp is emitted per distinct sample
time, and each consuming PulseOp is rewired to the appropriate one. This makes
sharing a waveform across multiple ports safe.
Shapes that hardware supports natively (defaulting to
SquareWaveform) are left untouched, and waveforms with any
non-constant operand (for example, sweep variables) are also skipped to be handled at
runtime.
Sampling of acquisition weights is intentionally deferred; weights are expected to move to
an attribute on AcquireOp rather than a
waveform operand, at which point a dedicated pass can materialise them.
The pass runs xDSL’s CanonicalizePass before its own rewrites, so any operand
chain that folds to a constant (e.g. arith.mulf of two arith.constants) is
collapsed first and then treated as a compile-time-constant operand.
- class EvaluateWaveformsAsSamples(port_sample_times, ignored_shapes=<factory>)
Bases:
ModulePassEvaluate analytical waveform ops into constant sampled waveforms.
For every
IsAnalyticalWaveformInterfaceop with all-constant operands, the op is replaced with one or moreConstantOps carrying aSampledWaveformAttrof the pre-computed IQ samples — one per distinct sample time across the pulses that consume the waveform.- Variables:
port_sample_times – Mapping from
FrameTypeport-kind token (e.g."control","readout") to the sample time in seconds used to discretise waveforms on that port class.ignored_shapes – Waveform shapes whose analytical form is natively supported by the hardware and should not be sampled. Defaults to
(SquareWaveform,).
- apply(ctx, op)
- Return type:
None
-
ignored_shapes:
tuple[type,...]
- name: ClassVar[str] = 'waveform-evaluation'
-
port_sample_times:
dict[str,float]