qat.experimental.conversion.pulse_to_q1.phase module
Phase rewrite strategies for the Pulse-to-Q1 conversion.
PhaseLegalisation canonicalises constant pulse.phase operands into the
[0, 2π) range. Dynamic operands are rewritten with
builtin.unrealized_conversion_cast to an unallocated integer register.
This cast is a staged type bridge. It does not define numeric conversion.
PhaseLowering consumes canonical constants and casted dynamic operands.
The constant path converts radians to degrees, then to NCO phase steps.
The dynamic path expects an integer register already interpreted as NCO phase
steps and normalises it into the valid sequencer interval.
- class PhaseLegalisation
Bases:
objectCallable strategy that canonicalises a
pulse.phase_setorpulse.phase_shiftoperand to the[0, 2π)radian range and replaces the op with an equivalent Pulse op carrying the normalised constant.The stage stays within the Pulse dialect. Constant operand finiteness is enforced upstream by
Q1PulseValidationPass.Dynamic operands are rewritten with
builtin.unrealized_conversion_castinto an unallocated integer register. This is a staged typing contract. It is not a numeric radians-to-steps conversion.
- class PhaseLowering
Bases:
objectCallable strategy for the lowering stage.
Lowering is distinct from legalisation. Canonical Pulse constants map to immediate Q1 phase instructions. Dynamic operands map to register Q1 phase instructions with modulo- loop normalisation.
Constant conversion from radians is lossy. Values are quantised into sequencer NCO phase-step space prior to emission.