qat.frontend.builder module

class BuilderFrontend(model, pipeline=None)

Bases: BaseFrontend

Allows a PurrInstructionBuilder to be used as an input to the compiler.

Parses the PurrInstructionBuilder into a InstructionBuilder containing QAT IR instructions, and then runs a pipeline to sanitise the IR.

Parameters:

model (PhysicalHardwareModel) – The hardware model is used to validate that the instruction builder is compatible with the target hardware.

check_and_return_source(src)

Checks that the source is a PurrInstructionBuilder and returns it.

Return type:

bool | InstructionBuilder

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

Parses the PuRR instruction builder and returns it as QAT IR.

Parameters:
  • src (InstructionBuilder) – The source instruction builder to parse. Must be a PurrInstructionBuilder.

  • res_mgr (Optional[ResultManager]) – The result manager to use when running the pipeline. If not provided, a result manager will be created.

  • met_mgr (Optional[MetricsManager]) – The metrics manager to use when running the pipeline. If not provided, a metrics manager will be created.

  • compiler_config (Optional[CompilerConfig]) – The compiler configuration is passed to the pipeline. If not provided, a default will be created.

Return type:

InstructionBuilder