qat.core.qat module

class QAT(qatconfig=None)

Bases: object

compile(program, compiler_config=None, pipeline='default', to_json=False)

Compiles a source program into an executable using the specified pipeline.

Parameters:
  • program – The source program to compile.

  • compiler_config (Optional[CompilerConfig]) – Configuration options for the compiler, such as optimization and results formatting.

  • pipeline (Pipeline | str) – The pipeline to use for compilation. Defaults to “default”.

  • to_json (bool) – If True, the output package will be serialized to JSON format.

Return type:

tuple[InstructionBuilder | Executable | str, MetricsManager]

Returns:

A tuple containing the executable of the compiled program for the target device and the metrics manager containing metrics collected during compilation.

execute(package, compiler_config=None, pipeline='default')

Executes a compiled package on the specified pipeline.

Parameters:
  • package (InstructionBuilder | Executable | str) – The compiled package to execute, which can be provided as a JSON blob.

  • compiler_config (Optional[CompilerConfig]) – Configuration options for the compiler, such as optimization and results formatting.

  • pipeline (Pipeline | str) – The pipeline to use for execution. Defaults to “default”.

Return type:

tuple[dict, MetricsManager]

Returns:

A tuple containing the results of the execution and the metrics manager

reload_all_models()

Reloads all hardware models and updates the pipelines.

run(program, compiler_config=None, pipeline='default', compile_pipeline=None, execute_pipeline=None)

Compiles and executes a source program using the specified pipeline.

The compilation and execution pipeline can be specified separately using compile_pipeline and execute_pipeline which take precedence . Alternatively, a unified pipeline can be provided using the pipeline parameter. If neither are provided, the default pipeline will be used for both compilation and execution.

Parameters:
  • program – The source program to compile and execute.

  • compiler_config (Optional[CompilerConfig]) – Configuration options for the compiler, such as optimization and results formatting.

  • pipeline (AbstractPipeline | str) – The pipeline to use for compilation and execution. Defaults to “default”.

  • compile_pipeline (Union[AbstractPipeline, str, None]) – The pipeline to use for compilation. If provided, it will override the pipeline parameter for compilation.

  • execute_pipeline (Union[AbstractPipeline, str, None]) – The pipeline to use for execution. If provided, it will override the pipeline parameter for execution.

Return type:

tuple[dict, MetricsManager]

Returns:

A tuple containing the results of the execution and the metrics manager