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

Only the PulseOp uses with a resolvable sample time are rewired. Any other user of the waveform (for example a MixOp, or a pulse on a port with no sample time) keeps reading the analytical op, which is erased only once it has no users left. This stops common subexpression elimination, which merges identical waveforms into one op, from blocking sampling for the users that can be sampled.

Shapes that hardware supports natively 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.

Constant folding is a separate concern handled by OrderedCanonicalizePass, which must run before this pass. That pass collapses any operand chain that folds to a constant (e.g. pulse.add of two ConstantOps) into a single ConstantOp, so this pass only ever has to recognise canonical constant operands. The requirement is enforced by the pipeline builder via required_predecessors().

class EvaluateWaveformsAsSamples(constraints)

Bases: OrderedPass, ModulePass

Evaluate analytical waveform ops into constant sampled waveforms.

For every IsAnalyticalWaveformInterface op with all-constant operands, the op is replaced with one or more ConstantOps carrying a SampledWaveformAttr of the pre-computed IQ samples — one per distinct sample time across the pulses that consume the waveform. Consumers that cannot be sampled (non-pulse users, or pulses on a port with no sample time) keep reading the analytical op, which is only erased when no users remain.

Variables:

constraints – The pulse-level constraints of the hardware, used to determine the sample time for each port and whether a waveform shape is supported natively.

apply(ctx, op)
Return type:

None

constraints: PulseLevelConstraints
name: ClassVar[str] = 'waveform-evaluation'
required_predecessors()

Pass classes that must be present in the same pipeline and run before this pass.

Return type:

frozenset[type[ModulePass]]