qat.experimental.conversion.pulse_to_q1.loop_fission module
Fission a shot loop into one copy per frame lineage.
A shot loop drives every frame in the program, so it belongs to every lineage at once and cannot be attributed to a single outlined sequence. Qblox runs one program per sequencer, each with its own loop, so the loop is replicated.
Only scf.for is handled. It is the sole region-bearing operation the importer puts
in a Pulse entry block, so it is the only shape that needs splitting today. Anything else
enclosing more than one lineage is rejected rather than guessed at, since splitting it
would need rules for its regions and block arguments that nothing yet exercises.
The copy carries no values between iterations. An scf.for can pass a value from one
iteration to the next through iter_args, and the importer uses that to accumulate
acquisitions into a results array. A sequencer has no equivalent: acquisitions land in
hardware bins, and the bin index is recomputed from the loop counter when the acquire is
lowered. The array is bookkeeping with no hardware counterpart, so the copy simply does
not have it.
- fission_for_lineage(op, lineage, analysis, value_mapper)
Build a copy of an
scf.forwith only the contents belonging tolineage.- Parameters:
op¶ (
Operation) – Shot loop enclosing the work of one or more lineages.lineage¶ (
FrameLineage) – Lineage whose work the returned copy carries.analysis¶ (
FrameLineageAnalysis) – Analysis providing per-operation lineage ownership.value_mapper¶ (
dict[SSAValue,SSAValue]) – Clone mapping for the partition, used to resolve operands defined by entry-block operations already copied into this sequence.
- Return type:
ForOp- Returns:
A newly built
scf.forcarrying onlylineage’s operations, with no loop-carried values.- Raises:
PassFailedException – If
opis not anscf.for, if the loop has an unsupported shape, or if the copy would have to carry a loop-carried value.
- is_results_op(op)
Return whether
opis a results-dialect operation.Results operations are bookkeeping with no hardware counterpart, so they are dropped from emitted sequences. Membership is tested against the dialect’s registered operations.
- Parameters:
op¶ (
Operation) – Operation to classify.- Return type:
bool- Returns:
Trueifopbelongs to the results dialect.