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.

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.

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