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.

Parameters:
  • ir – The intermediate representation.

  • res_mgr (Optional[ResultManager]) – Collection of analysis results with caching and aggregation capabilities, defaults to None.

  • 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.

Parameters:
  • ir – The intermediate representation.

  • res_mgr (Optional[ResultManager]) – Collection of analysis results with caching and aggregation capabilities, defaults to None.

  • 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.