qat.experimental.dialect.pulse.utils module
Structural utilities for the Pulse dialect.
- extract_frequency_hz(op)
Extract a constant frame frequency in Hertz from
pulse.create_frame.- Parameters:
op¶ (
CreateFrameOp) – The create-frame operation to extract from.- Return type:
float- Returns:
Frequency in Hertz as a Python float.
- Raises:
PassFailedException – If the frequency operand is not a constant or its attribute is not a
FrequencyAttr.
- extract_phase_radians(op)
Extract a constant phase in radians from a phase-manipulation operation.
- Parameters:
op¶ (
PhaseSetOp|PhaseShiftOp) – The phase operation to extract from.- Return type:
float- Returns:
Phase angle in radians as a Python float.
- Raises:
PassFailedException – If the phase operand is not a constant or its attribute is not a
PhaseAttr.
- extract_time_seconds(op)
Extract a constant wait duration in seconds from
pulse.wait.
- pulse_entry_block(module)
Return the block that carries the Pulse instruction stream.
Current repository producers use three concrete module shapes:
Frontend importers build a single
func.func @mainand place Pulse ops in its body block.The PuRR importer builds a
pulse.kernelcontaining the executable Pulse stream and afunc.func @maincontaining results processing.Some transforms and unit tests build a flat module with Pulse ops at top-level.
TODO(COMPILER-1380): remove this multi-shape logic once the canonical module shape is settled.
- Parameters:
module¶ (
ModuleOp) – The Pulse module to inspect.- Return type:
Block- Returns:
The entry block containing the Pulse instruction sequence.
- Raises:
PassFailedException – If the module contains multiple kernels, multiple functions without a kernel, or mixes a function with other non-kernel operations.
- require_constant_operand(op_name, operand_name, operand)
Return the defining
pulse.constantop for an SSA operand.- Parameters:
- Return type:
- Returns:
The
ConstantOpdefining the operand.- Raises:
PassFailedException – If the operand is not defined by a
ConstantOp.