qat.middleend.passes.analysis module
- class ActiveChannelResults(target_map=<factory>, unassigned=<factory>)
Bases:
ResultInfoMixin
Stores the active pulse channels in a task, which is defined by pulse channels that are acted on by a pulse or acquisition.
Results are stored as a map between pulse channels and the qubit they belong to. Rogue pulse channels are stored in the unassigned attribute. Various helper properties and methods can be used to fetch the complete lists of active pulse channels and qubits.
- from_qubit(qubit)
Returns the list of pulse channels that belong to a qubit.
- Return type:
list
[PulseChannel
]
-
target_map:
dict
[PulseChannel
,Qubit
]
- property targets: list[PulseChannel]
Returns a dictionary of all pulse channels with their full id as a key.
-
unassigned:
list
[PulseChannel
]
- class ActivePulseChannelAnalysis(model)
Bases:
AnalysisPass
Determines the set of pulse channels which are targeted by quantum instructions.
A pulse channel that has a pulse played at any time, or an acquisition is defined to be active. This pass is used to determine which pulse channels are required in compilation, and is used in subsequent passes to easily extract pulse channel properties, and is useful for not performing extra analysis on rogue channels picked up by
Synchronize
instructions.- run(ir, res_mgr, *args, **kwargs)
- Parameters:
ir¶ (
InstructionBuilder
) – The list of instructions stored in anInstructionBuilder
.res_mgr¶ (
ResultManager
) – The result manager to store the analysis results.
- Return type:
- class BatchedShots(model)
Bases:
AnalysisPass
Determines how shots should be grouped when the total number exceeds that maximum allowed.
The target machine might have an allowed number of shots that can be executed by a single execution call. To execute a number of shots greater than this value, shots can be batched, with each batch executed by its own “execute” call on the target machine. For example, if the maximum number of shots for a target machine is 2000, but you required 4000 shots, then this could be done as [2000, 2000] shots.
Now consider the more complex scenario where 4001 shots are required. Clearly this can be done in three batches. While it is tempting to do this in batches of [2000, 2000, 1], for some target machines, specification of the number of shots can only be achieved at compilation (as opposed to runtime). Batching as described above would result in us needing to compile two separate programs. Instead, it makes more sense to batch the shots as three lots of 1334 shots, which gives a total of 4002 shots. The extra two shots can just be discarded at run time.
Instantiate the pass with a hardware model.
- Parameters:
model¶ (
QuantumHardwareModel
) – The hardware model that contains the total number of shots.
- run(ir, res_mgr, *args, **kwargs)
- Parameters:
ir¶ (
InstructionBuilder
) – The list of instructions stored in anInstructionBuilder
.res_mgr¶ (
ResultManager
) – The result manager to store the analysis results.
- class BatchedShotsResult(total_shots, batched_shots)
Bases:
ResultInfoMixin
-
batched_shots:
int
-
total_shots:
int
-
batched_shots: