qat.frontend.base module
- class BaseFrontend(model=None)
Bases:
ABC
Base class for frontend that scans a high-level language-specific, but target-agnostic, input
QatInput
and verifies its syntax and semantics according to a specific source language (QASM, QIR, …). The input is optimised so as to adhere to the underlying topology of the QPU and is then compiled to a target-agnostic intermediate representation (IR)QatIR
that can be further optimised in the middle end.Generally, frontends are picked to match the source language. For example, a QIR source program should be coupled with the
QIRFrontend
. They implement compilation details that are specific to the source language via a pipeline, and parse it down to QAT IR.- Parameters:
model¶ (
Union
[None
,QuantumHardwareModel
,PhysicalHardwareModel
]) – The hardware model that holds calibrated information on the qubits on the QPU.
- abstract check_and_return_source(src)
- abstract emit(src, res_mgr=None, met_mgr=None, compiler_config=None)
Compiles an input
QatInput
down toQatIR
and emits it. :type _sphinx_paramlinks_qat.frontend.base.BaseFrontend.emit.src:Union
[str
,bytes
,InstructionBuilder
] :param _sphinx_paramlinks_qat.frontend.base.BaseFrontend.emit.src: The high-level input. :type _sphinx_paramlinks_qat.frontend.base.BaseFrontend.emit.res_mgr:Optional
[ResultManager
] :param _sphinx_paramlinks_qat.frontend.base.BaseFrontend.emit.res_mgr: Collection of analysis results with caching and aggregationcapabilities, defaults to None.
- Parameters:
met_mgr¶ (
Optional
[MetricsManager
]) – Stores useful intermediary metrics that are generated during compilation, defaults to None.compiler_config¶ (
Optional
[CompilerConfig
]) – Compiler settings, defaults to None.
- Return type:
- Returns:
An intermediate representation as an
InstructionBuilder
which holds a list of instructions to be executed on the QPU.