qat.middleend.base module

class BaseMiddleend(model)

Bases: ABC

Base class for a middle end that takes an intermediate representation (IR) QatIR and alters it based on optimisation and/or validation passes.

Parameters:

model (None | QuantumHardwareModel) – The hardware model that holds calibrated information on the qubits on the QPU.

abstract emit(ir, res_mgr=None, met_mgr=None, compiler_config=None, **kwargs)

Converts an IR QatIR to an optimised IR. :type _sphinx_paramlinks_qat.middleend.base.BaseMiddleend.emit.ir: :param _sphinx_paramlinks_qat.middleend.base.BaseMiddleend.emit.ir: The intermediate representation. :type _sphinx_paramlinks_qat.middleend.base.BaseMiddleend.emit.res_mgr: Optional[ResultManager] :param _sphinx_paramlinks_qat.middleend.base.BaseMiddleend.emit.res_mgr: Collection of analysis results with caching and aggregation

capabilities, 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.

class CustomMiddleend(model, pipeline=None)

Bases: BaseMiddleend

Middle end that uses a custom pipeline to convert the IR to an (optimised) IR.

Parameters:

model (None | QuantumHardwareModel) – The hardware model that holds calibrated information on the qubits on the QPU.

emit(ir, res_mgr=None, met_mgr=None, compiler_config=None, **kwargs)

Converts an IR QatIR to an optimised IR with a custom pipeline. :type _sphinx_paramlinks_qat.middleend.base.CustomMiddleend.emit.ir: :param _sphinx_paramlinks_qat.middleend.base.CustomMiddleend.emit.ir: The intermediate representation. :type _sphinx_paramlinks_qat.middleend.base.CustomMiddleend.emit.res_mgr: Optional[ResultManager] :param _sphinx_paramlinks_qat.middleend.base.CustomMiddleend.emit.res_mgr: Collection of analysis results with caching and aggregation

capabilities, 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.