qat.backend.base module
- class AllocatingBackend(model, pipeline=None)
Bases:
CustomBackend[Program],Generic[Program],ABCA backend that’s responsible for allocating FPGA card and sequencers AOT.
- Parameters:
model¶ (
QuantumHardwareModel) – The hardware model that holds calibrated information on the qubits on the QPU.
- allocate(target)
For a given target, allocate an FPGA card and a sequencer.
This is a greedy, first-come choice: it tracks one set of taken sequencers per slot but each physical channel has its own candidate set, so the outcome depends on the order targets arrive in and it can fail when a valid assignment exists. Prefer
allocate_bipartite(), which allocates all targets together.- Parameters:
target¶ (
PulseChannel) – The pulse channel to allocate a sequencer for.- Return type:
tuple[int,int]- Returns:
The sequencer index and the slot index.
- Raises:
ValueError – If the physical channel has no sequencer left.
- allocate_bipartite(targets)
Allocate sequencers to targets using a bipartite graph matching algorithm.
All targets are matched together, respecting each physical channel’s own candidate sequencers, so an assignment is found whenever one exists. Targets and candidates are sorted first, so the result does not depend on the order of
targets.- Parameters:
targets¶ (
list[PulseChannel]) – Pulse channels that need a sequencer.- Return type:
dict[int,dict[str,int]]- Returns:
Mapping of slot index to
{target_id: sequencer_index}.- Raises:
ValueError – If any target cannot be given a sequencer; the message names every target left unplaced.
- class BaseBackend(model)
Bases:
Generic[Program],ABCBase class for a backend that takes an intermediate representation (IR)
QatIRand lowers it to machine code that can be executed on a given target.- Parameters:
model¶ (
None|QuantumHardwareModel) – The hardware model that holds calibrated information on the qubits on the QPU.
- abstractmethod emit(ir, res_mgr=None, met_mgr=None, **kwargs)
Converts an IR
QatIRto machine instructions of a given target architecture.How targets convert the IR is at their discretion but they mostly follow macro- expansion techniques where target instructions are selected for each instruction in the IR.
- Return type:
Executable
- class CustomBackend(model, pipeline=None)
Bases:
BaseBackend[Program],Generic[Program],ABCBackends may need to run pre-codegen passes on the IR
QatIRas emitted from the middle end.These passes are specified via a custom pipeline.
- Parameters:
model¶ (
QuantumHardwareModel) – The hardware model that holds calibrated information on the qubits on the QPU.